/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package dao;

import Utility.PropReader;
import java.sql.Connection;
import constants.CommonConstants;
import java.sql.DriverManager;
/**
 *
 * @author Shuhail
 */
public class InitializeConnection {
    
    public Connection getConnection() {
        
        Connection conn=null;
        
          PropReader prop=PropReader.getInstance();
          
        try {
            String file=CommonConstants.DB_Prop_File;
            String driver=prop.getVal(CommonConstants.driver, file);
            String dbUrl=prop.getVal(CommonConstants.dbUrl, file);
            String uid=prop.getVal(CommonConstants.userid, file);
            String pass=prop.getVal(CommonConstants.password, file);
            
            Class.forName(driver);
            conn=DriverManager.getConnection(dbUrl, uid, pass);
            
        }catch(Exception e) {
            
            e.printStackTrace();
        }
        
        return conn;
    }
    
}
